namespace OOP
{
    /// <summary>
    /// 上帝类
    /// </summary>
    public class GodClass
    {
        /// <summary>
        /// 取出无效数值
        /// </summary>
        private void DropInvalid()
        {
            List<float> temp = new List<float>();
            foreach (var item in datas)
            {
                if(Math.Abs(item)>9999)
                {
                    continue;
                }
                temp.Add(item);
            }
            datas = temp;
        }   
        
        /// <summary>
        /// 单位转换
        /// </summary>
        private void UnitConvert(string srcUnit, string dstUnit)
        {

        }   
        
        /// <summary>
        /// 保留大于valueLimit的数据
        /// </summary>
        /// <param name="valueLimit"></param>
        private void KeepGreaterThan(float valueLimit)
        {

        }

        private void _Calc()
        {

        }
        
        /// <summary>
        /// Calculation
        /// </summary>
        public void Calculate()
        {
            string srcUnit = "degree", dstUnit="rad";
            DropInvalid();
            UnitConvert(srcUnit, dstUnit);
            _Calc();
            KeepGreaterThan(10);
            UnitConvert(dstUnit, srcUnit);
        }


        public void Display()
        {
            //Display Data
        }

        List<float> datas = new List<float>();
    }
    namespace Refactored
    {
        /// <summary>
        /// 处理无效值
        /// </summary>
        class Preprocesser
        {
            public List<float>  DropInvalid(List<float> data)
            {
                return data;
            }
        }

        class UnitConverter
        {
            public float Convert(string srcUnit, string dstUnit)
            {
                return float.NaN;
            }
        }

        class PostProcesser
        {
            public List<float> KeepGreaterThan(List<float> data, double value)
            {
                return data;
            }
        }

        
        class Calculator
        {
            public List<float> Calc(List<float> data)
            {
                return data;
            }
        }
         
        /// <summary>
        /// 替换GodClass
        /// </summary>
        class SimpleClass 
        {
            public void Calculate()
            {
                //调用各自的类去完成
                //前处理 
                //单位处理
                var c = new Calculator();
                c.Calc(datas);
                //后处理
                //单位转换
            }
            public void Display()
            {

            }

          List<float> datas = new List<float>();  
        }
    }
}